package org.dtrd.modules.record.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninWaistline;

import java.util.Date;

/**
 * @Author QR
 * @Date 2021/11/3 5:12 PM
 */
@ApiModel("腰围记录数据对象")
@Data
public class WaistLineBean {

    @ApiModelProperty("记录id")
    private Integer id;

    @ApiModelProperty("患者id")
    private Integer patientId;

    @ApiModelProperty("记录日期")
    private String recordTime;

    @ApiModelProperty("记录照片")
    private String recordPhoto;

    @ApiModelProperty("腰围值")
    private Integer waistLineValue;

    @ApiModelProperty("备注")
    private String waistLineRemark;

    public WaistLineBean(){}

    public WaistLineBean(Integer patientId, Date date, Integer value) {
        this.patientId = patientId;
        this.recordTime = DateUtils.formatDate(date, DateUtils.datetimeFormat.get().toPattern());
        this.waistLineValue = value;
    }

    public WaistLineBean parseFromPo(DtrdEntRdSigninWaistline po) {
        id = po.getDataId();
        patientId = po.getPatientId();
        recordTime = DateUtils.formatDate(po.getRecordDate(), DateUtils.date_sdf.get().toPattern());
        recordPhoto = po.getRecordPhoto();
        waistLineValue = po.getWaistlineValue();
        waistLineRemark = po.getWaistlineRemark();
        return this;
    }
}
